
setwd("\\Users\\spenc\\Documents\\R")
mc415<-read.csv("Election Model Calibration - April 15.csv")
summary(lm (Final.D.Margin ~ Polled.D.Margin + Previous.Margin -1, data= mc415))

mc61<-read.csv("Election Model Calibration - June 1.csv")
summary(lm (Final.D.Margin ~ Polled.D.Margin + Previous.Margin -1, data= mc61))

mc715<-read.csv("Election Model Calibration - July 15.csv")
summary(lm (Final.D.Margin ~ Polled.D.Margin + Previous.Margin -1, data= mc715))

mc91<-read.csv("Election Model Calibration - Sept 1.csv")
summary(lm (Final.D.Margin ~ Polled.D.Margin + Previous.Margin -1, data= mc91))


mc101<-read.csv("Election Model Calibration - Oct 1.csv")
summary(lm (Final.D.Margin ~ Polled.D.Margin + Previous.Margin -1, data= mc101))

m3<-lm (Final.D.Margin ~ Polled.D.Margin + Previous.Margin -1, data= mc91)
m4<-(lm (Final.D.Margin ~ Polled.D.Margin + Previous.Margin -1, data= mc101))

library('stargazer')
stargazer (m3,m4, type = 'text')

m1<-(lm (Final.D.Margin ~ Polled.D.Margin + Previous.Margin -1, data= mc415))
m2<-(lm (Final.D.Margin ~ Polled.D.Margin + Previous.Margin -1, data= mc61))
stargazer (m1,m2, type = 'text')

mced<-read.csv("Election Model Calibration - Election Day.csv")
summary(lm (Final.D.Margin ~ Polled.D.Margin + Previous.Margin -1, data= mced))

###Out of Sample
mcedoos<-read.csv("Election Model Calibration - Election Day No 2020.csv")
summary(lm (Final.D.Margin ~ Polled.D.Margin + Previous.Margin -1, data= mcedoos))


mcedoos16<-read.csv("Election Model Calibration - Election Day No 2016.csv")
summary(lm (Final.D.Margin ~ Polled.D.Margin + Previous.Margin -1, data= mcedoos16))

###Switch Effects####

switch<-read.csv("Out of Sample Tests - Switch.csv")
summary(lm (Dem.Lead~Days+Candidate+Drop.Out,data=switch))
